Skip to content

Conversation

@Gagan-Ram
Copy link
Member

@Gagan-Ram Gagan-Ram commented Oct 10, 2025

This PR is a part of fossasia/eventyay#1030

Summary by Sourcery

Align PayPal plugin references with the Eventyay namespace by replacing pretix imports, log identifiers, and metadata to use eventyay equivalents

Enhancements:

  • Replace pretix.* imports with eventyay.* across payment, views, signals, models, and apps modules
  • Update logger names and log_action/action_type values to eventyay.plugins.eventyay_paypal
  • Adjust migrations to depend on base instead of pretixbase and update foreign key targets accordingly
  • Rename plugin metadata class from PretixPluginMeta to EventyayPluginMeta

@sourcery-ai
Copy link

sourcery-ai bot commented Oct 10, 2025

Reviewer's Guide

Aligns all module imports, logging namespaces, plugin metadata, migration references, and log action types from pretix.* to eventyay.* to conform with the enext eventyay module structure.

Entity relationship diagram for updated ReferencedPayPalObject model

erDiagram
  ReferencedPayPalObject {
    string reference
    FK Order order
    FK OrderPayment payment
  }
  Order ||--o{ ReferencedPayPalObject : "has"
  OrderPayment ||--o{ ReferencedPayPalObject : "has"
Loading

Class diagram for updated PaypalPluginApp and plugin meta

classDiagram
  class PaypalPluginApp {
    name : str = "eventyay_paypal"
    verbose_name : str = _("PayPal")
  }
  class EventyayPluginMeta {
    name : str = _("PayPal")
    author : str = "eventyay"
    version : str = __version__
  }
  PaypalPluginApp <|-- EventyayPluginMeta
Loading

File-Level Changes

Change Details Files
Module import paths updated from pretix.* to eventyay.*
  • Replaced imports for decimal, models, payment, mail services, settings, URLs, and reverse utilities
eventyay_paypal/payment.py
eventyay_paypal/views.py
Logging namespace updated
  • Changed logger.getLogger calls from "pretix.plugins.eventyay_paypal" to "eventyay.plugins.eventyay_paypal"
eventyay_paypal/payment.py
eventyay_paypal/views.py
eventyay_paypal/paypal_rest.py
Log action types and signal filters renamed
  • Updated order.log_action keys from "pretix.event.order.refund.failed" to "eventyay.event.order.refund.failed"
  • Updated webhook log_action and shred_payment_info filters to use new prefix
  • Adjusted signal handlers to match renamed action types
eventyay_paypal/payment.py
eventyay_paypal/views.py
eventyay_paypal/signals.py
Plugin configuration class and imports aligned
  • Renamed PretixPluginMeta to EventyayPluginMeta
  • Updated plugin imports from pretix.base.plugins to eventyay.base.plugins
eventyay_paypal/apps.py
Model and migration foreign keys realigned
  • Changed migration dependencies and FK targets from pretixbase.* to base.*
  • Updated ReferencedPayPalObject model FKs to base.Order and base.OrderPayment
eventyay_paypal/migrations/0002_initial.py
eventyay_paypal/models.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Ensure that the migration dependency change from 'pretixbase' to 'base' does not disrupt the existing migration graph or require a data migration for existing databases.
  • Double-check that updating the logger names to 'eventyay.plugins.eventyay_paypal' matches your logging configuration so no log entries are dropped.
  • Verify that renaming the inner plugin class from PretixPluginMeta to EventyayPluginMeta is still recognized by your plugin loader and won’t break plugin discovery.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Ensure that the migration dependency change from 'pretixbase' to 'base' does not disrupt the existing migration graph or require a data migration for existing databases.
- Double-check that updating the logger names to 'eventyay.plugins.eventyay_paypal' matches your logging configuration so no log entries are dropped.
- Verify that renaming the inner plugin class from PretixPluginMeta to EventyayPluginMeta is still recognized by your plugin loader and won’t break plugin discovery.

## Individual Comments

### Comment 1
<location> `eventyay_paypal/apps.py:8-9` </location>
<code_context>
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _

from . import __version__

try:
    from eventyay.base.plugins import PluginConfig
except ImportError:
    raise RuntimeError("Python package 'paypal' is not installed.")

</code_context>

<issue_to_address>
**suggestion (code-quality):** Explicitly raise from a previous error ([`raise-from-previous-error`](https://docs.sourcery.ai/Reference/Default-Rules/suggestions/raise-from-previous-error/))

```suggestion
except ImportError as e:
    raise RuntimeError("Python package 'paypal' is not installed.") from e
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this PR against the enext branch.

@Gagan-Ram
Copy link
Member Author

Gagan-Ram commented Oct 11, 2025

Please make this PR against the enext branch.

The PR is made against enext branch only.
Sorry, I'll change the title.

@Gagan-Ram Gagan-Ram changed the title chore: align module imports with enext chore: align plugin against enext branch Oct 11, 2025
@mariobehling
Copy link
Member

I think you misunderstand. https://github.com/fossasia/eventyay-tickets-paypal/tree/enext here in this repo.

@Gagan-Ram Gagan-Ram changed the base branch from master to enext October 12, 2025 19:05
@Gagan-Ram Gagan-Ram force-pushed the chore/enext_global_settings__ey_paypal branch from c2318fd to a4bc304 Compare October 31, 2025 11:30
@Gagan-Ram
Copy link
Member Author

@hongquan could you please review this PR.

from .utils import safe_get

logger = logging.getLogger("pretix.plugins.eventyay_paypal")
logger = logging.getLogger("eventyay.plugins.eventyay_paypal")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace all logging.getLogger('xxx') to logging.getLogger(__name__)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'PluginConfig' is not used anywhere in app.py, so i remove try catch code and import statement too.

@mariobehling mariobehling requested a review from Copilot October 31, 2025 16:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request migrates the eventyay_paypal plugin from the pretix framework to the eventyay framework. The changes involve updating all import statements, logger names, action type identifiers, and database model references to replace "pretix" with "eventyay" throughout the codebase.

Key changes:

  • Updated all import statements from pretix.* to eventyay.*
  • Renamed logger identifiers from "pretix.plugins.eventyay_paypal" to "eventyay.plugins.eventyay_paypal"
  • Changed action type strings used in logging and signal handlers from "pretix." to "eventyay."
  • Updated Django model ForeignKey references from 'pretixbase.' to 'base.'
  • Consolidated database migrations and renamed plugin metadata class from PretixPluginMeta to EventyayPluginMeta

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
eventyay_paypal/views.py Updated imports from pretix to eventyay modules and changed logger/action type identifiers
eventyay_paypal/urls.py Updated import of event_url from pretix.multidomain to eventyay.multidomain
eventyay_paypal/signals.py Updated imports and all action type string identifiers used in signal handlers
eventyay_paypal/paypal_rest.py Changed logger identifier to use eventyay namespace
eventyay_paypal/payment.py Updated all imports and logger/action type identifiers throughout the payment provider class
eventyay_paypal/models.py Changed ForeignKey references from 'pretixbase' to 'base' for database models
eventyay_paypal/migrations/0002_initial.py Removed this migration file entirely (consolidated into 0001)
eventyay_paypal/migrations/0001_initial.py Updated to consolidate migration, changed dependency from 'pretixbase' to 'base', and updated field types
eventyay_paypal/apps.py Updated import and renamed PretixPluginMeta class to EventyayPluginMeta

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


try:
from pretix.base.plugins import PluginConfig
from eventyay.base.plugins import PluginConfig
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'PluginConfig' is not used.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@Gagan-Ram Gagan-Ram force-pushed the chore/enext_global_settings__ey_paypal branch from a4bc304 to 1765e5b Compare October 31, 2025 17:20
@mariobehling mariobehling merged commit a6d9cbd into fossasia:enext Nov 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants